<?php
    class Default_Model_Page extends Zend_Db_Table_Abstract
    {
        protected $_db;
		
		public function __construct()
		{
			$this->_db = Zend_Registry::get('db');
		}
        
        public function getPageById($id, $locale)
        {
            $sql = $this->_db->select()
                            ->from('page AS p', null)
                            ->join('page_language AS pl', 'pl.page_id = p.id', array('title', 'description'))
                            ->join('language AS l', 'l.id = pl.language_id', null)
                            ->where('p.id = ?', $id)
                            ->where('p.status = 1')
                            ->where('l.locale = ?', $locale);
            $result = $this->_db->fetchRow($sql);
            return $result;
        }
    }
